package com.ly.lypicturebackend.common;

import com.ly.lypicturebackend.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @author luyi
 * @date 2024/12/19 0:52
 */
@Data
public class BaseResponse<T> implements Serializable {
    private Integer code;
    private String message;
    private T data;

    public BaseResponse(Integer code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(Integer code, T data) {
        this.code = code;
        this.data = data;
    }
    public BaseResponse(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }
}
